<?php

class PasswordResetServiceTest extends PHPUnit_Framework_TestCase
{
    private $subject;

    /**
     * Prepares the environment before running a test.
     */
    protected function setUp ()
    {
        parent::setUp();
        $this->subject = RedCross_Factory::getService('Core_Service_PasswordReset');
    }

    /**
     * Cleans up the environment after running a test.
     */
    protected function tearDown ()
    {
        parent::tearDown();
        unset($this->subject);
    }

    public function testCreateRequestUsingANonExistingEmailShouldReturnFalse()
    {
    	$this->assertFalse($this->subject->createRequest(array('email' => 'nonexistingmail@mail.com')));
    }

    public function testCreateRequestUsingWrongUsernameShouldReturnFalse()
    {
    	$this->assertFalse($this->subject->createRequest(array('email' => 'kristian.tryggestad@gmail.com', 'username' => 'someUsername')));
    }

    public function testCreateRequestUsingInactiveUserShouldReturnFalse()
    {
    	$this->assertFalse($this->subject->createRequest(array('email' => 'invalid@dummy.com', 'username' => 'inactive')));
    }

    public function testCreateRequestUsingNonConfirmedUserShouldReturnFalse()
    {
    	$this->assertFalse($this->subject->createRequest(array('email' => 'dummy@dummy.com', 'username' => 'dummy')));
    }

}

